<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>第五次项目---洗衣机伪代码描述 - Even - A super concise theme for Hugo</title>
  <meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>

<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<meta name="theme-color" content="#f8f5ec" />
<meta name="msapplication-navbutton-color" content="#f8f5ec">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#f8f5ec">


<meta name="author" content="cuizx23333" /><meta name="description" content="第五次项目&amp;mdash;洗衣机伪代码描述 1.请使用伪代码分解“正常洗衣”程序的大步骤。包括注水、浸泡等 1 2 3 4 5 6 7 8 shut_up(); //开机 mode(mode_id); //选择模" /><meta name="keywords" content="Hugo, theme, even" />






<meta name="generator" content="Hugo 0.74.3 with theme even" />


<link rel="canonical" href="http://localhost:1313/post/project_5_washclothes/" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">



<link href="/sass/main.min.b5a744db6de49a86cadafb3b70f555ab443f83c307a483402259e94726b045ff.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.1.20/dist/jquery.fancybox.min.css" integrity="sha256-7TyXnr2YU040zfSP+rEcz29ggW4j56/ujTPwjMzyqFY=" crossorigin="anonymous">


<meta property="og:title" content="第五次项目---洗衣机伪代码描述" />
<meta property="og:description" content="第五次项目&mdash;洗衣机伪代码描述 1.请使用伪代码分解“正常洗衣”程序的大步骤。包括注水、浸泡等 1 2 3 4 5 6 7 8 shut_up(); //开机 mode(mode_id); //选择模" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://localhost:1313/post/project_5_washclothes/" />
<meta property="article:published_time" content="2020-10-26T00:00:00+00:00" />
<meta property="article:modified_time" content="2020-10-26T00:00:00+00:00" />
<meta itemprop="name" content="第五次项目---洗衣机伪代码描述">
<meta itemprop="description" content="第五次项目&mdash;洗衣机伪代码描述 1.请使用伪代码分解“正常洗衣”程序的大步骤。包括注水、浸泡等 1 2 3 4 5 6 7 8 shut_up(); //开机 mode(mode_id); //选择模">
<meta itemprop="datePublished" content="2020-10-26T00:00:00+00:00" />
<meta itemprop="dateModified" content="2020-10-26T00:00:00+00:00" />
<meta itemprop="wordCount" content="507">



<meta itemprop="keywords" content="" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="第五次项目---洗衣机伪代码描述"/>
<meta name="twitter:description" content="第五次项目&mdash;洗衣机伪代码描述 1.请使用伪代码分解“正常洗衣”程序的大步骤。包括注水、浸泡等 1 2 3 4 5 6 7 8 shut_up(); //开机 mode(mode_id); //选择模"/>

<!--[if lte IE 9]>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script>
<![endif]-->

<!--[if lt IE 9]>
  <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->

</head>
<body>
  <div id="mobile-navbar" class="mobile-navbar">
  <div class="mobile-header-logo">
    <a href="/" class="logo">Even</a>
  </div>
  <div class="mobile-navbar-icon">
    <span></span>
    <span></span>
    <span></span>
  </div>
</div>
<nav id="mobile-menu" class="mobile-menu slideout-menu">
  <ul class="mobile-menu-list">
    <a href="/">
        <li class="mobile-menu-item">Home</li>
      </a><a href="/post/">
        <li class="mobile-menu-item">Archives</li>
      </a><a href="/tags/">
        <li class="mobile-menu-item">Tags</li>
      </a><a href="/categories/">
        <li class="mobile-menu-item">Categories</li>
      </a><a href="/about/">
        <li class="mobile-menu-item">About</li>
      </a>
  </ul>
</nav>
  <div class="container" id="mobile-panel">
    <header id="header" class="header">
        <div class="logo-wrapper">
  <a href="/" class="logo">Even</a>
</div>

<nav class="site-navbar">
  <ul id="menu" class="menu">
    <li class="menu-item">
        <a class="menu-item-link" href="/">Home</a>
      </li><li class="menu-item">
        <a class="menu-item-link" href="/post/">Archives</a>
      </li><li class="menu-item">
        <a class="menu-item-link" href="/tags/">Tags</a>
      </li><li class="menu-item">
        <a class="menu-item-link" href="/categories/">Categories</a>
      </li><li class="menu-item">
        <a class="menu-item-link" href="/about/">About</a>
      </li>
  </ul>
</nav>
    </header>

    <main id="main" class="main">
      <div class="content-wrapper">
        <div id="content" class="content">
          <article class="post">
    
    <header class="post-header">
      <h1 class="post-title">第五次项目---洗衣机伪代码描述</h1>

      <div class="post-meta">
        <span class="post-time"> 2020-10-26 </span>
        
        
      </div>
    </header>

    <div class="post-toc" id="post-toc">
  <h2 class="post-toc-title">Contents</h2>
  <div class="post-toc-content always-active">
    <nav id="TableOfContents">
  <ul>
    <li><a href="#第五次项目---洗衣机伪代码描述">第五次项目&mdash;洗衣机伪代码描述</a>
      <ul>
        <li><a href="#1请使用伪代码分解正常洗衣程序的大步骤包括注水浸泡等">1.请使用伪代码分解“正常洗衣”程序的大步骤。包括注水、浸泡等</a></li>
        <li><a href="#2进一步用基本操作控制语句ifforwhile等变量与表达式写出每个步骤的伪代码">2.进一步用基本操作、控制语句（IF、FOR、WHILE等）、变量与表达式，写出每个步骤的伪代码</a></li>
        <li><a href="#3分析正常洗衣与快速洗衣在用户目标和程序上的异同">3.分析“正常洗衣”与“快速洗衣”在用户目标和程序上的异同</a></li>
        <li><a href="#4提取一些共性功能模块函数">4.提取一些共性功能模块（函数）</a></li>
      </ul>
    </li>
  </ul>
</nav>
  </div>
</div>
    <div class="post-content">
      <h1 id="第五次项目---洗衣机伪代码描述">第五次项目&mdash;洗衣机伪代码描述</h1>
<h2 id="1请使用伪代码分解正常洗衣程序的大步骤包括注水浸泡等">1.请使用伪代码分解“正常洗衣”程序的大步骤。包括注水、浸泡等</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span><span class="lnt">6
</span><span class="lnt">7
</span><span class="lnt">8
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-fallback" data-lang="fallback">shut_up(); //开机
mode(mode_id); //选择模式
water_in(n); //加水
sink(n); //浸泡
wash(mode_id); //洗衣
water_out(); //排水
dry(n); //甩干
shut_off(); //关机
</code></pre></td></tr></table>
</div>
</div><h2 id="2进一步用基本操作控制语句ifforwhile等变量与表达式写出每个步骤的伪代码">2.进一步用基本操作、控制语句（IF、FOR、WHILE等）、变量与表达式，写出每个步骤的伪代码</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span><span class="lnt">22
</span><span class="lnt">23
</span><span class="lnt">24
</span><span class="lnt">25
</span><span class="lnt">26
</span><span class="lnt">27
</span><span class="lnt">28
</span><span class="lnt">29
</span><span class="lnt">30
</span><span class="lnt">31
</span><span class="lnt">32
</span><span class="lnt">33
</span><span class="lnt">34
</span><span class="lnt">35
</span><span class="lnt">36
</span><span class="lnt">37
</span><span class="lnt">38
</span><span class="lnt">39
</span><span class="lnt">40
</span><span class="lnt">41
</span><span class="lnt">42
</span><span class="lnt">43
</span><span class="lnt">44
</span><span class="lnt">45
</span><span class="lnt">46
</span><span class="lnt">47
</span><span class="lnt">48
</span><span class="lnt">49
</span><span class="lnt">50
</span><span class="lnt">51
</span><span class="lnt">52
</span><span class="lnt">53
</span><span class="lnt">54
</span><span class="lnt">55
</span><span class="lnt">56
</span><span class="lnt">57
</span><span class="lnt">58
</span><span class="lnt">59
</span><span class="lnt">60
</span><span class="lnt">61
</span><span class="lnt">62
</span><span class="lnt">63
</span><span class="lnt">64
</span><span class="lnt">65
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-fallback" data-lang="fallback">shut_up(){
    power_on();
}
mode(){
    get mode_id;
    return mode_id;
}
water_in(n){
    switch(n){
        case 1: volume = 1L;
        case 2: volume = 2L;
        case 3: volume = 3L;
        case 4: volume = 4L;
    }
    water_in_switch(open);
    until(get_water_volume() == volume);
    water_in_switch(close);
}
sink(n){
    switch(n){
        case 1: time = 1min;
        case 2: time = 2min;
        case 3: time = 3min;
        case 4: time = 4min;
    }
    init time_counter();
    until(time_counter() == time);
}
wash(mode_id){
    switch(mode_id){
        case 1: time = 10min;
        case 2: time = 20min;
        case 3: time = 30min;
        case 4: time = 40min;
    }
    init time_counter();
    while(time_counter() &lt;= time){
        if((time_counter()/5s) % 2 == 0){
            motor_run(left);
        }
        else{
            motor_run(right);
        }
    }
    motor_run(stop);
}
water_out(){
    water_out_switch(open);
    until(get_water_volume() == 0);
    water_out_switch(close);
}
dry(){
    switch(n){
        case 1: time = 1min;
        case 2: time = 3min;
        case 3: time = 5min;
    }
    init time_counter();
    motor_run(left);
    until(time_counter() == time);
    motor_run(stop);
}
shut_off(){
    halt(succeed);
}
</code></pre></td></tr></table>
</div>
</div><h2 id="3分析正常洗衣与快速洗衣在用户目标和程序上的异同">3.分析“正常洗衣”与“快速洗衣”在用户目标和程序上的异同</h2>
<p>相同：所需要的过程相同，都是加水、浸泡、洗衣、排水、甩干。<br>
不同：所需时间，排水量不同。</p>
<h2 id="4提取一些共性功能模块函数">4.提取一些共性功能模块（函数）</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-fallback" data-lang="fallback">wait(time){
    init time_counter();
    method(start);
    until(time_counter() == time);
    method(end);
}
注水(volume,timeout){
    water_in_switch(open);
    until(get_water_volume() == volume);
    water_in_switch(close);
}
排水(){
    water_out_switch(open);
    until(get_water_volume() == 0);
    water_out_switch(close);
}
</code></pre></td></tr></table>
</div>
</div>
    </div>

    <div class="post-copyright">
  <p class="copyright-item">
    <span class="item-title">Author</span>
    <span class="item-content">cuizx23333</span>
  </p>
  <p class="copyright-item">
    <span class="item-title">LastMod</span>
    <span class="item-content">
        2020-10-26
        
    </span>
  </p>
  
  
</div>
<footer class="post-footer">
      
      <nav class="post-nav">
        <a class="prev" href="/post/homework_week9/">
            <i class="iconfont icon-left"></i>
            <span class="prev-text nav-default">第九周作业</span>
            <span class="prev-text nav-mobile">Prev</span>
          </a>
        <a class="next" href="/post/project_4_machine/">
            <span class="next-text nav-default">第四次项目</span>
            <span class="next-text nav-mobile">Next</span>
            <i class="iconfont icon-right"></i>
          </a>
      </nav>
    </footer>
  </article>
        </div>
        

  

  

      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="social-links">
      <a href="mailto:your@email.com" class="iconfont icon-email" title="email"></a>
      <a href="http://localhost:1313" class="iconfont icon-stack-overflow" title="stack-overflow"></a>
      <a href="http://localhost:1313" class="iconfont icon-twitter" title="twitter"></a>
      <a href="http://localhost:1313" class="iconfont icon-facebook" title="facebook"></a>
      <a href="http://localhost:1313" class="iconfont icon-linkedin" title="linkedin"></a>
      <a href="http://localhost:1313" class="iconfont icon-google" title="google"></a>
      <a href="http://localhost:1313" class="iconfont icon-github" title="github"></a>
      <a href="http://localhost:1313" class="iconfont icon-weibo" title="weibo"></a>
      <a href="http://localhost:1313" class="iconfont icon-zhihu" title="zhihu"></a>
      <a href="http://localhost:1313" class="iconfont icon-douban" title="douban"></a>
      <a href="http://localhost:1313" class="iconfont icon-pocket" title="pocket"></a>
      <a href="http://localhost:1313" class="iconfont icon-tumblr" title="tumblr"></a>
      <a href="http://localhost:1313" class="iconfont icon-instagram" title="instagram"></a>
      <a href="http://localhost:1313" class="iconfont icon-gitlab" title="gitlab"></a>
      <a href="http://localhost:1313" class="iconfont icon-bilibili" title="bilibili"></a>
  <a href="http://localhost:1313/index.xml" type="application/rss+xml" class="iconfont icon-rss" title="rss"></a>
</div>

<div class="copyright">
  <span class="power-by">
    Powered by <a class="hexo-link" href="https://gohugo.io">Hugo</a>
  </span>
  <span class="division">|</span>
  <span class="theme-info">
    Theme - 
    <a class="theme-link" href="https://github.com/olOwOlo/hugo-theme-even">Even</a>
  </span>

  

  <span class="copyright-year">
    &copy; 
    2017 - 
    2021<span class="heart"><i class="iconfont icon-heart"></i></span><span>olOwOlo</span>
  </span>
</div>

    </footer>

    <div class="back-to-top" id="back-to-top">
      <i class="iconfont icon-up"></i>
    </div>
  </div>
  
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/slideout@1.0.1/dist/slideout.min.js" integrity="sha256-t+zJ/g8/KXIJMjSVQdnibt4dlaDxc9zXr/9oNPeWqdg=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.1.20/dist/jquery.fancybox.min.js" integrity="sha256-XVLffZaxoWfGUEbdzuLi7pwaUJv1cecsQJQqGLe7axY=" crossorigin="anonymous"></script>



<script type="text/javascript" src="/js/main.min.c12618f9a600c40bd024996677e951e64d3487006775aeb22e200c990006c5c7.js"></script>








</body>
</html>
